package guitforl.wrappers

import _root_.guitforl.traits.Update
import scala.collection.mutable.HashMap

import org.eclipse.swt.widgets.{Composite, TabItem}

abstract class TabWrapper {
	val name: String

	val tab: TabItem

	private val composites = new HashMap[String, Composite]
	private val edits = new HashMap[String, EditWrapper]
	private var lables: List[LabelWrapper] = List()
	private var updatebleWidgets:List[Update] = List()
	//hash map of buttons, editc .. etc

	def init(caption: String): Unit = {
		tab.setText(caption)
	}

	def getComposite(compositeName: String) = {
		composites(compositeName)
	}

	def addEdit(editName: String, edit: EditWrapper) {
		edits += editName -> edit
	}

	def addLabel(label: LabelWrapper) {
		lables ::= label
	}

	def addComposite(compositeName: String, composite: Composite) {
		composites += compositeName -> composite
	}

	def addUpdatebleWidget(widget:Update):Unit = {
        updatebleWidgets ::= widget
    }

	override def toString() = {
		edits + "\n" + composites
	}

}
